﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.views.world {
    import flash.events.*;
    import flash.filters.*;
    import flash.utils.*;
    import net.wooga.pets.events.*;
    import net.wooga.pets.constants.*;
    import net.wooga.pets.utils.*;

    public class BabyView extends AbstractActorView {

        private var _blockTimer:Timer;

        private static const ANIMATIONTIME:Number = 3000;

        public function BabyView(_arg1:String, _arg2:String){
            super(_arg1, 0, 0, _arg2);
            scaleX = (scaleY = 1);
            mouseChildren = false;
            this._blockTimer = new Timer(ANIMATIONTIME, 1);
            this._blockTimer.addEventListener(TimerEvent.TIMER_COMPLETE, this.unblockAnimation);
        }
        override public function setEnabled():void{
            super.setEnabled();
            mouseChildren = false;
        }
        override public function getBitmapFilter():BitmapFilter{
            return (Filters.getFilter(Filters.BABY_GLOW));
        }
        public function get animationState():String{
            return (_animationState);
        }
        override public function setAnimationState(_arg1:String, _arg2:Boolean=false):void{
            if (_arg1 == GameConstants.ANIMATION_STATE_WALKING){
                this._blockTimer.stop();
            };
            if (!this._blockTimer.running){
                renderAnimationState(_asset, _arg1, _arg2);
                switch (_arg1){
                    case GameConstants.ANIMATION_STATE_HAPPY:
                    case GameConstants.ANIMATION_STATE_WAKE:
                        this._blockTimer.start();
                        break;
                };
            };
        }
        private function unblockAnimation(_arg1:Event):void{
            this._blockTimer.stop();
            dispatchEvent(new InfoEvent(EventConstants.ON_ANIMATION_FINISHED));
        }

    }
}//package net.wooga.pets.views.world 
